<!DOCTYPE html>
<!--[if lt IE 7]>       <html class="no-js lt-ie9 lt-ie8 lt-ie7">   <![endif]-->
<!--[if IE 7]>          <html class="no-js lt-ie9 lt-ie8">          <![endif]-->
<!--[if IE 8]>          <html class="no-js lt-ie9">                 <![endif]-->
<!--[if gt IE 8]><!-->  <html class="no-js">                        <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title><?php echo h($this->pageTitle) ?></title>
        <meta name="viewport" content="width=device-width">
        <link type="text/css" rel="stylesheet" href="<?php echo BACKEND_SITE_URL ?>css/bootstrap.min.css">
        <link type="text/css" rel="stylesheet" href="<?php echo BACKEND_SITE_URL ?>css/bootstrap-responsive.min.css">
        <link type="text/css" rel="stylesheet" href="<?php echo BACKEND_SITE_URL ?>css/font-awesome.min.css">
        <link type="text/css" rel="stylesheet" href="<?php echo BACKEND_SITE_URL ?>css/style.css">

        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
        <!--[if IE 7]>
        <link type="text/css" rel="stylesheet" href="<?php echo BACKEND_SITE_URL ?>css/font-awesome-ie7.min.css"/>
        <![endif]-->

        <script src="<?php echo BACKEND_SITE_URL ?>js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
    </head>
    <body>
        <!-- BEGIN WRAP -->
        <div id="wrap">


            <!-- BEGIN TOP BAR -->
            <div id="top">
                <!-- .navbar -->
                <div class="navbar navbar-inverse navbar-static-top">
                    <div class="navbar-inner">
                        <div class="container-fluid">
                            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </a>
                            <a class="brand" href="<?php echo FRONT_SITE_URL ?>"><?php echo app()->name ?></a>
                            <!-- .topnav -->
                            <div class="btn-toolbar topnav">
                                <div class="btn-group">
                                    <a id="changeSidebarPos" class="btn btn-success" rel="tooltip"
                                       data-original-title="Show / Hide Sidebar" data-placement="bottom">
                                        <i class="icon-resize-horizontal"></i>
                                    </a>
                                </div>
                                <div class="btn-group">
                                    <a class="btn btn-inverse" rel="tooltip" data-original-title="E-mail" data-placement="bottom" href="<?php echo url('/contactus') ?>">
                                        <i class="icon-envelope"></i>
                                        <span class="label label-warning"><?php echo $this->newEmailCount ?></span>
                                    </a>
                                </div>
                                <div class="btn-group">
                                    <a class="btn btn-inverse" rel="tooltip" href="<?php echo url('/cms/post/create', array('post_type' => 'post')) ?>" data-original-title="New post"
                                       data-placement="bottom">
                                        <i class="icon-file"></i>
                                    </a>
                                    <a href="#helpModal" class="btn btn-inverse" rel="tooltip" data-placement="bottom"
                                       data-original-title="Help" data-toggle="modal">
                                        <i class="icon-question-sign"></i>
                                    </a>
                                </div>
                                <div class="btn-group">
                                    <a class="btn btn-inverse" data-placement="bottom" data-original-title="Logout" rel="tooltip" onclick='return confirm("Are you sure?")' href="<?php echo url('/site/logout') ?>"><i class="icon-off"></i></a></div>
                            </div>
                            <!-- /.topnav -->
                            <div class="nav-collapse collapse">
                                <!-- .nav -->
                                <?php
                                $this->widget('bootstrap.widgets.TbMenu', array(
                                    'items' => array(
                                        array('label' => 'Content Manager', 'url' => '#', 'items' => array(
                                            array('label' => 'Create new post', 'url' => array('/cms/post/create', 'post_type' => 'post')),
                                            array('label' => 'Create new page', 'url' => array('/cms/post/create', 'post_type' => 'page')),
                                        )),
                                        array('label' => 'Gallery', 'url' => '#', 'items' => array(
                                            array('label' => 'Portfolio', 'url' => array('/gallery/index', 'id' => 'portfolio')),
                                            array('label' => 'Home page slider', 'url' => array('/gallery/index', 'id' => 'slider')),
                                        )),
                                        array('label' => 'Newsletter', 'url' => '#', 'items' => array(
                                            array('label' => 'View subscribers', 'url' => array('/newsletter/index')),
                                            array('label' => 'Send newsletter', 'url' => array('/newsletter/send')),
                                        ))
                                    )
                                ));
                                ?>
                                <!-- /.nav -->
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.navbar -->
            </div>
            <!-- END TOP BAR -->


            <!-- BEGIN HEADER.head -->
            <header class="head">
                <div class="search-bar">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="search-bar-inner">
                                <a id="menu-toggle" href="#menu" data-toggle="collapse"
                                   class="accordion-toggle btn btn-inverse visible-phone"
                                   rel="tooltip" data-placement="bottom" data-original-title="Show/Hide Menu">
                                    <i class="icon-sort"></i>
                                </a>

                                <form class="main-search" action="<?php echo url('/cms/search') ?>">
                                    <input class="input-block-level" type="text" placeholder="Live search..." name="keywords" />
                                    <button id="searchBtn" type="submit" class="btn btn-inverse"><i class="icon-search"></i></button>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- ."main-bar -->
                <div class="main-bar">
                    <div class="container-fluid">
                        <div class="row-fluid">
                            <div class="span12">
                                <?php if (isset($this->breadcrumbs)): ?>
                                <div id='breadcrumbs'>
                                    <?php
                                    $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
                                        'links' => $this->breadcrumbs,
                                        'encodeLabel' => FALSE,
                                    ));
                                    ?>
                                </div><!-- breadcrumbs -->
                                <?php endif ?>
                            </div>
                        </div>
                        <!-- /.row-fluid -->
                    </div>
                    <!-- /.container-fluid -->
                </div>
                <!-- /.main-bar -->
            </header>
            <!-- END HEADER.head -->

            <!-- BEGIN LEFT  -->
            <div id="left">
                <!-- .user-media -->
                <div class="media user-media hidden-phone">
                    <a href="" class="user-link">
                        <img src="<?php echo user()->getModel()->getAvatarUrl('small') ?>" alt="" class="media-object img-polaroid user-img" width="64" />
                    </a>

                    <div class="media-body hidden-tablet">
                        <h5 class="media-heading"><?php echo h(user()->name) ?></h5>
                        <ul class="unstyled user-info">
                            <li><a href="#">Administrator</a></li>
                            <li>Last Login : <br/>
                                <small><?php echo date('Y-m-d H:i:s') ?></small>
                            </li>
                        </ul>
                    </div>
                </div>
                <!-- /.user-media -->

                <!-- BEGIN MAIN NAVIGATION -->

                <ul id="menu" class="unstyled accordion collapse in">
                    <li class="accordion-group <?php echo $this->activeMenu == 'dashboard' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#dashboard-nav">
                            <i class="icon-dashboard icon-large"></i> Dashboard <span class="label label-inverse pull-right">2</span>
                        </a>
                        <ul class="collapse" id="dashboard-nav">
                            <li><a href="<?php echo url('/dashboard/index') ?>"><i class="icon-angle-right"></i>Quick link</a></li>
                            <li><a href="<?php echo url('/dashboard/statistic') ?>"><i class="icon-angle-right"></i>Statistic</a></li>
                        </ul>
                    </li>
                    <li class="accordion-group <?php echo $this->activeMenu == 'cms' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#cms-nav">
                            <i class="icon-tasks icon-large"></i> Content manager <span class="label label-inverse pull-right">2</span>
                        </a>
                        <ul class="collapse " id="cms-nav">
                            <li><a href="<?php echo url('/cms/post/index', array('post_type' => 'page')) ?>"><i class="icon-angle-right"></i>Page</a></li>
                            <li><a href="<?php echo url('/cms/post/index', array('post_type' => 'post')) ?>"><i class="icon-angle-right"></i>Blog</a></li>
                        </ul>
                    </li>
                    <li <?php echo $this->activeMenu == 'calendar' ? 'class="active"' : ''; ?>><a href="<?php echo url('/cal') ?>"><i class="icon-calendar icon-large"></i> Calendar</a></li>
                    <li class="accordion-group <?php echo $this->activeMenu == 'user' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#user-nav">
                            <i class="icon-user icon-large"></i> User manager <span class="label label-inverse pull-right">2</span>
                        </a>
                        <ul class="collapse " id="user-nav">
                            <li><a href="<?php echo url('/user/member') ?>"><i class="icon-angle-right"></i>All Member</a></li>
                            <li><a href="<?php echo url('/user/member/create') ?>"><i class="icon-angle-right"></i>Add new</a></li>
                        </ul>
                    </li>
                    <li class="accordion-group <?php echo $this->activeMenu == 'contact' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#contact-nav">
                            <i class="icon-envelope icon-large"></i> Contact <span class="label label-inverse pull-right">2</span>
                        </a>
                        <ul class="collapse " id="contact-nav">
                            <li><a href="<?php echo url('/contactus/index') ?>"><i class="icon-angle-right"></i>All messages</a></li>
                            <li><a href="<?php echo url('/contactus/send') ?>"><i class="icon-angle-right"></i>Send</a></li>
                        </ul>
                    </li>
                    <li class="accordion-group <?php echo $this->activeMenu == 'gallery' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#gallery-nav">
                            <i class="icon-tasks icon-large"></i> Gallery manager <span class="label label-inverse pull-right">2</span>
                        </a>
                        <ul class="collapse " id="gallery-nav">
                            <li><a href="<?php echo url('/gallery/index', array('id' => 'slider')) ?>"><i class="icon-angle-right"></i>Home page slider</a></li>
                            <li><a href="<?php echo url('/gallery/index', array('id' => 'portfolio')) ?>"><i class="icon-angle-right"></i>Portfolio</a></li>
                        </ul>
                    </li>
                    <li class="accordion-group <?php echo $this->activeMenu == 'setting' ? 'active' : ''; ?>">
                        <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#setting-nav">
                            <i class="icon-wrench icon-large"></i> Settings <span class="label label-inverse pull-right">5</span>
                        </a>
                        <ul class="collapse " id="setting-nav">
                            <li><a href="<?php echo url('/setting/index', array('type' => 'site')) ?>"><i class="icon-angle-right"></i>Site settings</a></li>
                            <li><a href="<?php echo url('/setting/index', array('type' => 'email')) ?>"><i class="icon-angle-right"></i>Email</a></li>
                            <li><a href="<?php echo url('/setting/index', array('type' => 'seo')) ?>"><i class="icon-angle-right"></i>SEO</a></li>
                            <li><a href="<?php echo url('/setting/index', array('type' => 'sem')) ?>"><i class="icon-angle-right"></i>SEM</a></li>
                            <li><a href="<?php echo url('/setting/deleteCache') ?>"><i class="icon-angle-right"></i>Clear cache</a></li>
                        </ul>
                    </li>
                </ul>
                <!-- END MAIN NAVIGATION -->

            </div>
            <!-- END LEFT -->

            <!-- BEGIN MAIN CONTENT -->
            <div id="content">
                <!-- .outer -->
                <div class="container-fluid outer">
                    <div class="row-fluid">
                        <!-- .inner -->
                        <div class="span12 inner">
                           <?php echo $content ?>
                        </div>
                        <!-- /.inner -->
                    </div>
                    <!-- /.row-fluid -->
                </div>
                <!-- /.outer -->
            </div>
            <!-- END CONTENT -->


            <!-- #push do not remove -->
            <div id="push"></div>
            <!-- /#push -->
        </div>
        <!-- END WRAP -->

        <div class="clearfix"></div>

        <!-- BEGIN FOOTER -->
        <div id="footer">
            <p><?php echo date('Y') ?> - HT</p>
        </div>
        <!-- END FOOTER -->

        <!-- #helpModal -->
        <div id="helpModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel"
             aria-hidden="true">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
                <h3 id="helpModalLabel"><i class="icon-external-link"></i> Help</h3>
            </div>
            <div class="modal-body">
                <p>
                    Beta version
                </p>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
            </div>
        </div>
        <!-- /#helpModal -->
        <script src="<?php echo BACKEND_SITE_URL ?>js/vendor/jquery-migrate-1.1.1.min.js"></script>
        <script src="<?php echo BACKEND_SITE_URL ?>js/lib/jquery.tablesorter.min.js"></script>
        <script src="<?php echo BACKEND_SITE_URL ?>js/lib/jquery.mousewheel.js"></script>
        <script src="<?php echo BACKEND_SITE_URL ?>js/sticky.min.js"></script>
        <script src="<?php echo BACKEND_SITE_URL ?>js/main.js"></script>
        <script type="text/javascript">
            <?php if(user()->hasFlash('success')) : ?>
            $.sticky("<?php echo h(user()->getFlash('success')) ?>", {autoclose : 5000, position: "top-right" , type: "st-success"});
            <?php endif; ?>
            <?php if(user()->hasFlash('error')) : ?>
            $.sticky("<?php echo h(user()->getFlash('error')) ?>", {autoclose : 5000, position: "top-right" , type: "st-error"});
            <?php endif; ?>
            <?php if(user()->hasFlash('info')) : ?>
            $.sticky("<?php echo h(user()->getFlash('info')) ?>", {autoclose : 5000, position: "top-right" , type: "st-info"});
            <?php endif; ?>
        </script>
    </body>
</html>